{include file="public/header" /} 
<script type="text/javascript" charset="utf-8" src="/static/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="/static//ueditor/lang/zh-cn/zh-cn.js"></script>

<div>
    <form id="supplier_edit" action="" method="post" >
        <input type="hidden" name="r" value="admin/edit" />
        <input type="hidden" name="supplier_id" value=""/>
        <div>
            <span>标题：</span>
            <input class="form-control" type="text" name="name" style="width: 200px;" value=""/>
        </div>
        <div>
            <span>主图：</span>
            <div>
                <input  type="hidden" id="logo" name="thumb" value="http://7xloiv.com1.z0.glb.clouddn.com/default.jpg"/>
                <img id="showImage" src="http://7xloiv.com1.z0.glb.clouddn.com/default.jpg" style="width:200px; height: 200px;">
                <script id="editorUpLoad" type="text/plain" ></script>
            </div>
            
            <a class="btn btn-info" id="uploadFile">图片上传</a>
        </div>
        <div>
            <span>描述：</span>
            <textarea class="form-control"></textarea>
        </div>
        <div>
            <span>内容：</span>
            <script id="editor" name="content" type="text/plain" style="width:800px;height:400px;"></script>
        </div>
        <div>
            <input class="btn btn-info" type="submit" name="submit" value="保存"/>
        </div>
    </form>
    
</div>

<hr />

<script type="text/javascript">
    $(function(){
        ue2 = UE.getEditor('editor');
        ue = UE.getEditor("editorUpLoad");
        ue.ready(function (){
            //设置编辑器不可用(事实上不可以设置不可用...所以注释掉,以观后效)
            //_editor.setDisabled();
    
            //隐藏编辑器,因为只使用上传功能
            ue.hide();
            //侦听图片上传
            ue.addListener('beforeInsertImage',function(t,arg){
                //将图片地址赋给input
                $("#logo").attr("value",arg[0].src);
                //将图片地址赋给img的src,实现预览
                $("#showImage").attr("src",arg[0].src);
            });
        });
        
        $("#uploadFile").click(function(){
            var myImage = ue.getDialog("insertimage");
            myImage.open();
            
        })
        
    });
    
</script>


	    <div>this view</div>
	    {foreach $list as $key=>$content} 
	    <div>{$key}:{$content->content_id}</div>
	    {/foreach}
{include file="public/footer" /} 